Data storing method and memory controller and memory storage device using the same

ABSTRACT

A data storing method for a rewritable non-volatile memory module and a memory controller and a memory storage device using the same are provided. The data storing method includes moving or writing data into a physical erase unit of the rewritable non-volatile memory module and determining whether the physical erase unit contains a dancing bit. The data storing method further includes when the physical erase unit contains the dancing bit, restoring the rewritable non-volatile memory module to the state before the data is moved or moving the data from the physical erase unit to another physical erase unit. Thereby, the data storing method can effectively ensure the reliability of the data.

CROSS-REFERENCE TO RELATED APPLICATION

This is a divisional application of U.S. patent application Ser. No.13/633,887, filed on Oct. 3, 2012, now allowed, which claims thepriority benefit of Taiwan application serial no. 101128084, filed onAug. 3, 2012. The entirety of each of the above-mentioned patentapplications is hereby incorporated by reference herein and made a partof this specification.

BACKGROUND

1. Technology Field

The present invention relates to a data storing method for a rewritablenon-volatile memory module and a memory controller and a memory storagedevice using the same.

2. Description of Related Art

Along with the widespread of digital cameras, cell phones, and MP3players in recently years, the consumers' demand to storage media hasincreased drastically. Rewritable non-volatile memory is one of the mostadaptable storage media to aforementioned portable electronic devices(for example, notebook computers) due to its many characteristics suchas data non-volatility, low power consumption, small volume,non-mechanical structure, and fast access speed. A solid state drive(SSD) is a storage device which uses a flash memory as its storagemedium. Thereby, the flash memory industry has become a very importantpart of the electronic industry in recent years.

NAND flash memories can be categorized into single level cell (SLC) NANDflash memories, multi level cell (MLC) NAND flash memories, and trinarylevel cell (TLC) NAND flash memories according to the number of bitsthat would be stored in each memory cell. Each memory cell of a SLC NANDflash memory stores 1-bit data (i.e., “1” and “0”). Each memory cell ofa MLC NAND flash memory stores 2-bit data. Each memory cell of a TLCNAND flash memory stores 3-bit data.

In a NAND flash memory, a physical page is composed of several memorycells arranged on the same word line. Since each memory cell of a SLCNAND flash memory stores 1-bit data, in the SLC NAND flash memory, thememory cells arranged on the same word line are corresponding to onephysical page.

On the other hand, the floating-gate storage layer of each memory cellin a MLC NAND flash memory can store 2-bit data. Herein each storagestate (i.e., “11”, “10”, “01”, and “00”) includes a least significantbit (LSB) and a most significant bit (MSB). For example, in each storagestate, the first bit from the left is the LSB, and the second bit fromthe left is the MSB. Thus, the memory cells arranged on the same wordline constitute 2 physical pages. Herein the physical page constitutedby the LSBs of the memory cells is referred to as a lower physical page,and the physical page constituted by the MSBs of the memory cells isreferred to as an upper physical page.

In particular, the write speed of a lower physical page is faster thanthat of an upper physical page, and when the upper physical page isprogrammed and an error occurs, data stored in the lower physical pagemay also be lost.

Similarly, each memory cell in a TLC NAND flash memory can store 3-bitdata. Herein each storage state (i. e., “111”, “110”, “101”, “100”,“011”, “010”, “001”, and “000”) includes a LSB (the first bit from theleft), a center significant bit (CSB, the second bit from the left), anda MSB (the third bit from the left). Thus, the memory cells arranged onthe same word line constitute 3 physical pages. Herein the physical pageconstituted by the LSBs of the memory cells is referred to as a lowerphysical page, the physical page constituted by the CSBs of the memorycells is referred to as a middle physical page, and the physical pageconstituted by the MSBs of the memory cells is referred to as an upperphysical page. In particular, when the memory cells arranged on the sameword line are programmed, either only the lower physical pages or allthe lower physical pages, the middle physical pages, and the upperphysical pages are programmed to prevent data loss.

Thereby, how to ensure the accuracy of data stored in a flash memory isone of the major subjects in the industry.

Nothing herein should be construed as an admission of knowledge in theprior art of any portion of the present invention. Furthermore, citationor identification of any document in this application is not anadmission that such document is available as prior art to the presentinvention, or that any reference forms a part of the common generalknowledge in the art.

SUMMARY

Accordingly, the present invention is directed to a data storing methodand a memory controller and a memory storage device using the same, inwhich the reliability and accuracy of data is effectively ensured.

An exemplary embodiment of the present invention provides a data storingmethod adapted to a memory storage device. The memory storage device hasa rewritable non-volatile memory module. The rewritable non-volatilememory module has a plurality of physical erase units. Each of thephysical erase units has a plurality of physical program units. Aplurality of logical addresses is configured to map a part of thephysical erase units. The data storing method includes selecting a firstlogical address among the logical addresses. Herein the first logicaladdress is mapped to a plurality of physical erase units among thephysical erase units. The data storing method also includes selecting afirst physical erase unit among the physical erase units, moving validdata belonging to the first logical address from the physical eraseunits mapped to the first logical address into the first physical eraseunit, and determining whether the first physical erase unit contains adancing bit. The data storing method further includes executing anerasing operation on the first physical erase unit when the firstphysical erase unit contains the dancing bit.

An exemplary embodiment of the present invention provides a memorycontroller for controlling a rewritable non-volatile memory module in amemory storage device. The rewritable non-volatile memory module has aplurality of physical erase units, and each of the physical erase unitshas a plurality of physical program units. The memory controllerincludes a host interface, a memory interface, and a memory managementcircuit. The host interface is configured to couple to a host system.The memory interface is configured to couple to the rewritablenon-volatile memory module. The memory management circuit is coupled tothe host interface and the memory interface. The memory managementcircuit configures a plurality of logical addresses to map to a part ofthe physical erase units. The memory management circuit also selects afirst logical address among the logical addresses. Herein the firstlogical address is mapped to a plurality of physical erase units amongthe physical erase units. The memory management circuit further selectsa first physical erase unit among the physical erase units, moves validdata belonging to the first logical address from the physical eraseunits mapped to the first logical address into the first physical eraseunit, and determines whether the first physical erase unit contains adancing bit. When the first physical erase unit contains the dancingbit, the memory management circuit executes an erasing operation on thefirst physical erase unit.

An exemplary embodiment of the present invention provides a memorystorage device including a connector, a rewritable non-volatile memorymodule, and a memory controller. The connector is configured to coupleto a host system. The rewritable non-volatile memory module has aplurality of physical erase units, and each of the physical erase unitshas a plurality of physical program units. The memory controller iscoupled to the connector and the rewritable non-volatile memory module.The memory controller configures a plurality of logical addresses to mapto a part of the physical erase units. The memory controller alsoselects a first logical address among the logical addresses. Herein thefirst logical address is mapped to a plurality of physical erase unitsamong the physical erase units. The memory controller further selects afirst physical erase unit among the physical erase units, moves validdata belonging to the first logical address from the physical eraseunits mapped to the first logical address into the first physical eraseunit, and determines whether the first physical erase unit contains adancing bit. When the first physical erase unit contains the dancingbit, the memory controller executes an erasing operation on the firstphysical erase unit.

An exemplary embodiment of the present invention provides a data storingmethod for a rewritable non-volatile memory module. The rewritablenon-volatile memory module has a plurality of physical erase units. Eachof the physical erase units has a plurality of physical program units.The physical erase units are grouped into at least a system area. Thedata storing method includes writing system data into a first physicalerase unit in the system area, determining whether the first physicalerase unit contains a dancing bit, and when the first physical eraseunit contains a dancing bit, selecting a second physical erase unit andwriting the system data into the second physical erase unit.

As described above, exemplary embodiments of the present inventionprovides a data storing method, a memory controller, and a memorystorage device, in which the reliability of stored data is effectivelyensured and data loss is prevented.

It should be understood, however, that this Summary may not contain allof the aspects and embodiments of the present invention, is not meant tobe limiting or restrictive in any manner, and that the invention asdisclosed herein is and will be understood by those of ordinary skill inthe art to encompass obvious improvements and modifications thereto.

These and other exemplary embodiments, features, aspects, and advantagesof the invention will be described and become more apparent from thedetailed description of exemplary embodiments when read in conjunctionwith accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings are included to provide a furtherunderstanding of the invention, and are incorporated in and constitute apart of this specification. The drawings illustrate embodiments of theinvention and, together with the description, serve to explain theprinciples of the invention.

FIG. 1 illustrates a host system and a memory storage device accordingto an exemplary embodiment of the present invention.

FIG. 2 is a diagram of a computer, an input/output device, and a memorystorage device according to an exemplary embodiment of the presentinvention.

FIG. 3 is a diagram of a host system and a memory storage deviceaccording to an exemplary embodiment of the present invention.

FIG. 4 is a schematic block diagram of a memory storage device accordingto an exemplary embodiment of the present invention.

FIG. 5 is a schematic block diagram of a memory controller according toan exemplary embodiment of the present invention.

FIG. 6 and FIG. 7 are diagrams illustrating an example of managing arewritable non-volatile memory module according to an exemplaryembodiment of the present invention.

FIG. 8 and FIG. 9 illustrate an example of writing an update data byusing a substitution physical erase unit according to an exemplaryembodiment of the present invention.

FIG. 10 illustrates an example of a data merging operation according toan exemplary embodiment of the present invention.

FIG. 11 and FIG. 12 are diagrams illustrating how data is written andmerged by using a substitution physical erase unit and a random physicalerase unit according to an exemplary embodiment of the presentinvention.

FIG. 13 is a flowchart of a data storing method according to anexemplary embodiment of the present invention.

FIG. 14 is a diagram illustrating how a system data is stored accordingto an exemplary embodiment of the present invention.

FIG. 15 is a diagram illustrating how a system data is stored accordingto another exemplary embodiment of the present invention.

FIG. 16 is a flowchart of a data storing method according to anotherexemplary embodiment of the present invention, in which the steps ofwriting a system data into a system area are illustrated.

DESCRIPTION OF THE EMBODIMENTS

Reference will now be made in detail to the present preferredembodiments of the invention, examples of which are illustrated in theaccompanying drawings. Wherever possible, the same reference numbers areused in the drawings and the description to refer to the same or likeparts.

Embodiments of the present invention may comprise any one or more of thenovel features described herein, including in the Detailed Description,and/or shown in the drawings. As used herein, “at least one”, “one ormore”, and “and/or” are open-ended expressions that are both conjunctiveand disjunctive in operation. For example, each of the expressions “atleast one of A, B and C”, “at least one of A, B, or C”, “one or more ofA, B, and C”, “one or more of A, B, or C” and “A, B, and/or C” means Aalone, B alone, C alone, A and B together, A and C together, B and Ctogether, or A, B and C together.

It is to be noted that the term “a” or “an” entity refers to one or moreof that entity. As such, the terms “a” (or “an”), “one or more” and “atleast one” can be used interchangeably herein.

Generally speaking, a memory storage device (also referred to as amemory storage system) includes a rewritable non-volatile memory moduleand a controller (also referred to as a control circuit). A memorystorage device is usually used with a host system so that the hostsystem can write data into or read data from the memory storage device.

FIG. 1 illustrates a host system and a memory storage device accordingto an exemplary embodiment of the invention.

Referring to FIG. 1, the host system 1000 includes a computer 1100 andan input/output (I/O) device 1106. The computer 1100 includes amicroprocessor 1102, a random access memory (RAM) 1104, a system bus1108, and a data transmission interface 1110. The I/O device 1106includes a mouse 1202, a keyboard 1204, a display 1206, and a printer1252, as shown in FIG. 2. However, the I/O device 1106 is not limited tothe devices illustrated in FIG. 2 and may further include other devices.

In the present embodiment, a memory storage device 100 is coupled toother components of the host system 1000 via the data transmissioninterface 1110. Data can be written into or read from the memory storagedevice 100 through the operations of the microprocessor 1102, the RAM1104, and the I/O device 1106. The memory storage device 100 is arewritable non-volatile memory storage device, such as the flash drive1256, the memory card 1214, or the solid state drive (SSD) 1216illustrated in FIG. 2.

Generally speaking, the host system 1000 can be substantially any systemthat works with the memory storage device 100 to store data. Even thoughthe host system 1000 is described as a computer system in the presentexemplary embodiment, in another exemplary embodiment of the invention,the host system 1000 may also be a digital camera, a video camera, acommunication device, an audio player, or a video player. For example,if the host system is a digital camera (video camera) 1310, therewritable non-volatile memory storage device is then a secure digital(SD) card 1312, a multi media card (MMC) card 1314, a memory stick (MS)1316, a compact flash (CF) card 1318, or an embedded storage device 1320(as shown in FIG. 3) used by the digital camera (video camera) 1310. Theembedded storage device 1320 includes an embedded MMC (eMMC). It shouldbe mentioned that an eMMC is directly coupled to the motherboard of ahost system.

FIG. 4 is a schematic block diagram of a memory storage device accordingto the present exemplary embodiment.

Referring to FIG. 4, the memory storage device 100 includes a connector102, a memory controller 104, and a rewritable non-volatile memorymodule 106.

In the present exemplary embodiment, the connector 102 complies with theSD interface standard. However, the invention is not limited thereto,and the connector 102 may also comply with the parallel advancedtechnology attachment (PATA) standard, the Institute of Electrical andElectronic Engineers (IEEE) 1394 standard, the peripheral componentinterconnect (PCI) express standard, the universal serial bus (USB)standard, the serial advanced technology attachment (SATA) standard, theultra high speed-I (UHS-I) interface standard, the ultra high speed-II(UHS-II) interface standard, the MS interface standard, the MMCinterface standard, the eMMC interface standard, the universal flashstorage (UFS) interface standard, the CF interface standard, theintegrated device electronics (IDE) standard, or any other suitablestandard.

The memory controller 104 executes a plurality of logic gates or controlinstructions implemented in a hardware form or a firmware form andperforms data writing, reading, and erasing operations on the rewritablenon-volatile memory module 106 according to commands issued by the hostsystem 1000.

The rewritable non-volatile memory module 106 is coupled to the memorycontroller 104 and configured to store data written by the host system1000. The rewritable non-volatile memory module 106 has physical eraseunits 304(0)-304(R). The physical erase units 304(0)-304(R) may belongto the same memory die or different memory dies. Each physical eraseunit has a plurality of physical program units. The physical programunits belonging to the same physical erase unit can be individuallywritten but have to be erased all together. Each physical erase unit maybe composed of 128 physical program units. However, the presentinvention is not limited thereto, and each physical erase unit may alsobe composed of 64, 256, or any other number of physical program units.

To be specific, physical erase unit is the smallest unit for erasingdata. Namely, each physical erase unit contains the least number ofmemory cells that are erased all together. Physical program unit is thesmallest unit for programming data. Namely, physical program unit is thesmallest unit for writing data. Each physical program unit usuallyincludes a data bit area and a redundant bit area. The data bit areaincludes a plurality of physical access addresses for storing user data,and the redundant bit area is used for storing system data (for example,control information and error checking and correcting codes (ECCs)). Inthe present exemplary embodiment, the data bit area of each physicalprogram unit includes 4 physical access addresses, and the size of eachphysical access address is 512 bytes. However, the size and number ofthe physical access addresses are not limited in the invention, and inother exemplary embodiments, a data bit area may also any greater orsmaller number of physical access addresses. In an exemplary embodiment,the physical erase units are physical blocks, and the physical programunits are physical pages or physical sectors. However, the presentinvention is not limited thereto.

In the present exemplary embodiment, the rewritable non-volatile memorymodule 106 is a trinary level cell (TLC) NAND flash memory module (i.e.,each memory cell stores data of at least 3 bits). However, the presentinvention is not limited thereto, and the rewritable non-volatile memorymodule 106 may also be a single level cell (SLC) NAND flash memorymodule, a multi level cell (MLC) NAND flash memory module, any otherflash memory module, or any memory module with the same characteristics.

FIG. 5 is a schematic block diagram of a memory controller according toan exemplary embodiment of the present invention. It should beunderstood that the structure of the memory controller illustrated inFIG. 5 is only an example but not intended to limit the scope of thepresent invention.

Referring to FIG. 5, the memory controller 104 includes a memorymanagement circuit 202, a host interface 204, and a memory interface206.

The memory management circuit 202 controls the overall operation of thememory controller 104. To be specific, the memory management circuit 202has a plurality of control instructions, and when the memory storagedevice 100 is in operation, the control instructions are executed toperform data writing, data reading, and data erasing operations.

In the present exemplary embodiment, the control instructions of thememory management circuit 202 are implemented in a firmware form. Forexample, the memory management circuit 202 has a microprocessor unit(not shown) and a read-only memory (ROM, not shown), and the controlinstructions are burnt into the ROM. When the memory storage device 100is in operation, the control instructions are executed by themicroprocessor unit to carry out data writing, data reading, and dataerasing operations.

In another exemplary embodiment of the invention, the controlinstructions of the memory management circuit 202 may also be stored ina specific area of the rewritable non-volatile memory module 106 (forexample, a system area exclusively used for storing system data in amemory module) as program codes. In addition, the memory managementcircuit 202 has a microprocessor unit (not shown), a ROM (not shown),and a RAM (not shown). In particular, the ROM has boot codes. When thememory controller 104 is enabled, the microprocessor unit first executesthe boot codes to load the control instructions from the rewritablenon-volatile memory module 106 into the RAM of the memory managementcircuit 202. Thereafter, the microprocessor unit runs the controlinstructions to perform various data writing, reading, and erasingoperations.

In yet another exemplary embodiment of the present invention, thecontrol instructions of the memory management circuit 202 may also beimplemented in a hardware form. For example, the memory managementcircuit 202 includes a microcontroller, a memory cell managementcircuit, a memory writing circuit, a memory reading circuit, a memoryerasing circuit, and a data processing circuit. The memory cellmanagement circuit, the memory writing circuit, the memory readingcircuit, the memory erasing circuit, and the data processing circuit arecoupled to the microcontroller. The memory cell management circuit isconfigured to manage the physical erase units of the rewritablenon-volatile memory module 106. The memory writing circuit is configuredto issue a write command to the rewritable non-volatile memory module106 to write data into the rewritable non-volatile memory module 106.The memory reading circuit is configured to issue a read command to therewritable non-volatile memory module 106 to read data from therewritable non-volatile memory module 106. The memory erasing circuit isconfigured to issue an erase command to the rewritable non-volatilememory module 106 to erase data from the rewritable non-volatile memorymodule 106. The data processing circuit is configured to process data tobe written into and read from the rewritable non-volatile memory module106.

The host interface 204 is coupled to the memory management circuit 202and configured to receive and identify commands and data from the hostsystem 1000. Namely, commands and data transmitted by the host system1000 are transmitted to the memory management circuit 202 through thehost interface 204. In the present exemplary embodiment, the hostinterface 204 complies with the SD standard. However, the presentinvention is not limited thereto, and the host interface 204 may alsocomply with the PATA standard, the IEEE 1394 standard, the PCI expressstandard, the USB standard, the SATA standard, the UHS-I interfacestandard, the UHS-II interface standard, the MS standard, the MMCstandard, the eMMC interface standard, the UFS interface standard, theCF standard, the IDE standard, or any other suitable data transmissionstandard.

The memory interface 206 is coupled to the memory management circuit 202and configured to access the rewritable non-volatile memory module 106.Namely, data to be written into the rewritable non-volatile memorymodule 106 is converted by the memory interface 206 into a formatacceptable to the rewritable non-volatile memory module 106.

In an exemplary embodiment of the present invention, the memorycontroller 104 further includes a buffer memory 252, a power managementcircuit 254, and an ECC circuit 256.

The buffer memory 252 is coupled to the memory management circuit 202and configured to temporarily store data and commands from the hostsystem 1000 or data from the rewritable non-volatile memory module 106.

The power management circuit 254 is coupled to the memory managementcircuit 202 and configured to control the power supply of the memorystorage device 100.

The ECC circuit 256 is coupled to the memory management circuit 202 andconfigured to perform an ECC procedure to ensure data accuracy. In thepresent exemplary embodiment, when the memory management circuit 202receives a write command from the host system 1000, the ECC circuit 256generates a corresponding

ECC code for the data corresponding to the write command, and the memorymanagement circuit 202 writes the data corresponding to the writecommand and the corresponding ECC code into the rewritable non-volatilememory module 106. Subsequently, when the memory management circuit 202reads the data from the rewritable non-volatile memory module 106, italso reads the ECC code corresponding to the data, and the ECC circuit256 performs the ECC procedure on the data according to the ECC code. Tobe specific, the ECC circuit 256 is designed to correct a specificnumber of error bits (referred to as a maximum correctable error bitnumber thereinafter). For example, the maximum correctable error bitnumber is 24. If the number of error bits in data is not greater than24, the ECC circuit 256 can correct the values of the error bitsaccording to the corresponding ECC code. Otherwise, the ECC circuit 256reports that the error correcting process fails, and the memorymanagement circuit 202 sends a message indicating that the data is lostto the host system 1000.

FIG. 6 and FIG. 7 are diagrams illustrating an example of managing arewritable non-volatile memory module according to an exemplaryembodiment of the present invention.

It should be understood that while describing the operations performedon the physical erase units of the rewritable non-volatile memory module106, the terms like “select”, “substitute”, “group”, and “alternate”refer to logical operations performed on the physical erase units.Namely, the actual positions of the physical erase units in therewritable non-volatile memory module 106 are not changed and theoperations are logically performed on the physical erase units of therewritable non-volatile memory module 106.

Referring to FIG. 6, the memory controller 104 (or the memory managementcircuit 202) logically groups (or allocates) the physical erase unit304(0)-304(R) of the rewritable non-volatile memory module 106 into adata area 402, a spare area 404, a system area 406, and a replacementarea 408.

The physical erase units logically belonging to the data area 402 andthe spare area 404 are used for storing data from the host system 1000.To be specific, the physical erase units (also referred to as dataphysical erase units) in the data area 402 are considered physical eraseunits containing data, while the physical erase units (also referred toas spare physical erase units) in the spare area 404 are physical eraseunits used for writing new data. For example, when a write command anddata to be written are received from the host system 1000, the memorycontroller 104 (or the memory management circuit 202) selects a physicalerase unit from the spare area 404, processes the data to be written,and writes the data into the selected physical erase unit.

The physical erase units logically belonging to the system area 406 areused for recording system data. Herein the system data includes themanufacturer and model of the memory chip, the number of physical eraseunits in the memory chip, and the number of physical program units ineach physical erase unit, etc.

The physical erase units logically belonging to the replacement area 408are substitution physical erase units. For example, after the rewritablenon-volatile memory module 106 is manufactured, 4% of its physical eraseunits are reserved for substitution purpose. Namely, when a physicalerase unit in the data area 402, the spare area 404, or the system area406 is damaged, a physical erase unit in the replacement area 408 isused for replacing the damaged physical erase unit (i.e., a bad block).Thus, if there are still normal physical erase units in the replacementarea 408 and a physical erase unit is damaged, the memory controller 104(or the memory management circuit 202) selects a normal physical eraseunit from the replacement area 408 to replace the damaged physical eraseunit. If there is not any normal physical erase unit in the replacementarea 408 and a physical erase unit is damaged, the memory controller 104declares that the memory storage device 100 enters a write protect stateand no data should be written therein.

In particular, the numbers of the physical erase units in the data area402, the spare area 404, the system area 406, and the replacement area408 vary with different memory specifications. In addition, during theoperation of the memory storage device 100, the physical erase unitsgrouped into the data area 402, the spare area 404, the system area 406,and the replacement area 408 are dynamically changed. For example, whena physical erase unit in the spare area 404 is damaged and accordinglyreplaced by a physical erase unit in the replacement area 408, thephysical erase unit originally belonging to the replacement area 408 islinked to the spare area 404.

Referring to FIG. 7, in order to allow the host system 1000 toconveniently access the physical erase units that are alternatively usedfor storing data, the memory controller 104 configures logical addressesLBA(0)-LBA(H) to map the physical erase units in the data area 402 suchthat the host system 1000 can directly write and read data according tothese logical addresses. In the present exemplary embodiment, the memorycontroller 104 (or the memory management circuit 202) maintains alogical address-physical erase unit mapping table to record the mappingrelationship (i.e., mapping information) between the logical addressesLBA(0)-LBA(H) and the physical erase units in the data area 402.

FIG. 8 and FIG. 9 illustrate an example of writing an update data byusing a substitution physical erase unit according to an exemplaryembodiment of the present invention.

Referring to both FIG. 8 and FIG. 9, when the logical address LBA(0) ismapped to the physical erase unit 304(0) and the memory controller 104receives a write command for writing update data into a logical programunit corresponding to the logical address LBA(0) from the host system1000, the memory controller 104 identifies that the logical addressLBA(0) is currently mapped to the physical erase unit 304(0) accordingto the logical address-physical erase unit mapping table and selects thephysical erase unit 304(D+1) from the spare area 404 for writing theupdate data. However, in the course of writing the update data into thephysical erase unit 304(D+1), the memory controller 104 does notinstantly move all valid data in the physical erase unit 304(0) to thephysical erase unit 304(D+1) to erase the physical erase unit 304(0). Tobe specific, the memory controller 104 (or the memory management circuit202) reads the valid data before the physical program unit to be written(i.e., data in the 0th physical program unit and the 1^(st) physicalprogram unit of the physical erase unit 304(0)) from the physical eraseunit 304(0). After that, the memory controller 104 (or the memorymanagement circuit 202) writes the valid data before the physicalprogram unit to be written in the physical erase unit 304(0) into the0^(th) physical program unit and the 1^(st) physical program unit of thephysical erase unit 304(D+1) (as shown in FIG. 8) and writes the updatedata into the 2^(nd) to the 4^(th) physical program unit of the physicalerase unit 304(D+1) (as shown in FIG. 9). Herein the memory controller104 completes the data writing operation. Because the valid data in thephysical erase unit 304(0) may become invalid in a next operation (forexample, a write command), instantly moving all valid data in thephysical erase unit 304(0) to the physical erase unit 304(D+1) maybecome meaningless. In addition, data has to be written into thephysical program units of a physical erase unit according to the writesequence of the physical program units. Thus, the memory controller 104(or the memory management circuit 202) only moves the valid data beforethe physical program unit to be written (i.e., data stored in the 0^(th)physical program unit and the 1^(st) physical program unit of thephysical erase unit 304(0)) and does not move the remaining valid data(i.e., data stored in the 5^(th) to the K^(th) physical program unit ofthe physical erase unit 304(0)) for the time being. Namely. The physicalprogram units in the physical erase unit 304(0) and the physical eraseunit 304(D+1) are mapped to the logical program units corresponding tothe logical address LBA(0).

In the present exemplary embodiment, the operation of maintainingaforementioned temporary relationship is referred to as openingmother-child physical erase units. Besides, the original physical eraseunit (i.e., the physical erase unit 304(0)) is referred to as a motherphysical erase unit or an updated physical erase unit, and the physicalerase unit for substituting the mother physical erase unit (i.e., thephysical erase unit 304(D+1)) is referred to as a child physical eraseunit or a substitution physical erase unit. Herein a mother physicalerase unit and a child physical erase unit used for storing databelonging to the same logical address are referred to as a mother-childphysical erase unit set.

It should be mentioned that the number of physical erase units in thespare area 404 is limited. Accordingly, during the operation of thememory storage device 100, the number of open mother-child physicalerase unit sets is also limited. Namely, during the operation of thememory storage device 100, the number of open mother-child physicalerase unit sets cannot exceed a mother-child physical erase unit numberthreshold. In the present exemplary embodiment, the mother-childphysical erase unit number threshold is set to 3. However, the presentinvention is not limited thereto. Thus, when the memory storage device100 receives a write command from the host system 1000, if the number ofopen mother-child physical erase unit sets reaches the mother-childphysical erase unit number threshold, the memory controller 104 needs toperform a data merging operation to close at least one mother-childphysical erase unit set before it executes the write command. To bespecific, during the data merging operation, the memory controller 104combines the data of the mother physical erase unit and the childphysical erase unit into a single physical erase unit.

FIG. 10 illustrates an example of a data merging operation according toan exemplary embodiment of the present invention.

Referring to FIG. 10, if the valid data in the physical erase unit304(0) and the physical erase unit 304(D+1) (as shown in FIG. 9) is tobe merged, the memory controller 104 (or the memory management circuit202) reads the remaining valid data (i.e., data in the 5^(th) to theK^(th) physical program unit of the physical erase unit 304(0)) from thephysical erase unit 304(0) and writes the remaining valid data in thephysical erase unit 304(0) into the 5^(th) to the K^(th) physicalprogram unit of the physical erase unit 304(D+1). Thereafter, the memorycontroller 104 (or the memory management circuit 202) links the physicalerase unit 304(D+1) to the data area 402. Namely, the memory controller104 (or the memory management circuit 202) re-maps the logical addressLBA(0) to the physical erase unit 304(D+1) in the logicaladdress-physical erase unit mapping table. In addition, the memorycontroller 104 (or the memory management circuit 202) performs anerasing operation on the physical erase unit 304(0) and links the erasedphysical erase unit 304(0) to the spare area 404. In the presentexemplary embodiment, the memory controller 104 (or the memorymanagement circuit 202) may establish a spare area physical erase unittable (not shown) for recording the physical erase units currentlylinked to the spare area 404.

Because the logical program units of the logical addresses are mapped tothe physical program units of different physical erase units in thecourse of opening mother-child physical erase units, the memorycontroller 104 (or the memory management circuit 202) may use a variabletable to record the temporary relationship between the logical addressesand the mother-child physical erase unit sets.

Besides using a substitution physical erase unit to write data, in thepresent exemplary embodiment, the memory controller 104 (or the memorymanagement circuit 202) further selects at least one physical erase unitfrom the spare area 404 as a random physical erase unit and uses therandom physical erase unit for writing data. For example, if data of alogical program unit to be updated by the host system 1000 is alreadywritten into a substitution physical erase unit, the update data istemporarily written into a random physical erase unit.

FIG. 11 and FIG. 12 are diagrams illustrating how data is written andmerged by using a substitution physical erase unit and a random physicalerase unit according to an exemplary embodiment of the presentinvention.

Referring to FIG. 11, when the physical erase unit 304(D+2) is selectedas a random physical erase unit and the host system 1000 is about towrite update data into the 1^(st) logical program unit of the logicaladdress LBA(0) in the storage state illustrated in FIG. 9, the memorymanagement circuit 202 writes the update data into the first blankphysical program unit of the random physical erase unit (for example,the 0^(th) physical program unit of the physical erase unit 304(D+2)).

In the present exemplary embodiment, when the current random physicalerase unit is full, the memory management circuit 202 selects anotherphysical erase unit from the spare area 404 as a new random physicalerase unit until the number of physical erase units in the spare area404 is smaller than a predetermined number. To be specific, because thenumber of physical erase units in the spare area 404 is limited, thenumber of physical erase units that can be served as random physicalerase units is also limited. When the number of physical erase units inthe spare area 404 is smaller than the predetermined number, the memorycontroller 104 (or the memory management circuit 202) performs a datamerging operation, performs an erasing operation on each random physicalerase unit that contains only invalid data, and links the erasedphysical erase units to the spare area 404. Thereby, when a next writecommand is executed, the memory management circuit 202 can select ablank physical erase unit from the spare area 404 as a random physicalerase unit.

Referring to FIG. 12, when a data merging operation is performed on thelogical address LBA(0) in the state illustrated in FIG. 11, the memorycontroller 104 (or the memory management circuit 202) selects a blankphysical erase unit 304(D+3) from the spare area 404, copies valid databelonging to the logical address LBA(0) from the physical erase unit304(0), the substitution physical erase unit 304(D+1), and the randomphysical erase unit 304(D+2) into the physical erase unit 304(D+3), andre-maps the logical address LBA(0) to the physical erase unit 304(D+3).

To be specific, in the course of copying the valid data, data in the0^(th) physical program unit of the physical erase unit 304(0) is readand written into the 0^(th) physical program unit of the physical eraseunit 304(D+3). After that, data in the 1^(st) physical program unit ofthe physical erase unit 304(D+2) is read and written into the 1^(st)physical program unit of the physical erase unit 304(D+3). Next, data inthe 2^(nd) to the 4^(th) physical program unit of the physical eraseunit 304(D+1) is sequentially read and written into the 2^(nd) to the4^(th) physical program unit of the physical erase unit 304(D+3).Eventually, data in the 5^(th) to the K^(th) physical program unit ofthe physical erase unit 304(0) is read and written into the 5^(th) tothe K^(th) physical program unit of the physical erase unit 304(D+3). Inparticular, after moving the valid data, the memory controller 104 (orthe memory management circuit 202) records that the logical addressLBA(0) is re-mapped to the physical erase unit 304(D+3) (i.e., links thephysical erase unit 304(D+3) to the data area 402) in the logicaladdress-physical erase unit mapping table, performs erasing operationson the physical erase unit 304(0), the physical erase unit 304(D+1), andthe physical erase unit 304(D+2) (i.e., erases data from the physicalerase unit 304(0), the physical erase unit 304(D+1), and the physicalerase unit 304(D+2)), and links the physical erase unit 304(0), thephysical erase unit 304(D+1), and the physical erase unit 304(D+2) tothe spare area 404.

As described above, in the present exemplary embodiment, during theoperation of the memory storage device 100, the memory controller 104(or the memory management circuit 202) selects a physical erase unitfrom the spare area 404 as a substitution physical erase unit for aphysical erase unit which already contains data (i.e., a data physicalerase unit in the data area 402) or a random physical erase unit fortemporarily storing data, so as to increase the efficiency in writingdata. It should be understood that the number of substitution physicalerase units or random physical erase units is not limited to 1. Forexample, the memory controller 104 (or the memory management circuit202) can configure multiple substitution physical erase units ormultiple random physical erase units for one data physical erase unit towrite update data. Herein the substitution physical erase units and therandom physical erase units are all referred to as temporary physicalerase units.

In the present exemplary embodiment, after writing data to be stored bythe host system 1000 into a substitution physical erase unit or a randomphysical erase unit, the memory controller 104 (or the memory managementcircuit 202) sends a response indicating that the write command iscompleted to the host system 1000 and then performs a data mergingprocedure at a proper timing (for example, when it is in an idle state).

However, if a power failure occurs to the memory storage device 100 whenthe data merging procedure is performed, data may not be successfullymoved into the new physical erase unit. In the present exemplaryembodiment, the memory controller 104 (or the memory management circuit202) determines whether the data is successfully written into the newphysical erase unit through an ECC procedure (or the ECC circuit 256).

For example, as shown in FIG. 12, if a power failure occurs during theoperations in which valid data belonging to the logical address LBA(0)is moved from the physical erase unit 304(0), the physical erase unit304(D+1), and the physical erase unit 304(D+2) into the physical eraseunit 304(D+3), once the memory storage device 100 is powered on again,the memory controller 104 (or the memory management circuit 202) scansthe redundant bit areas in the physical erase units and accordinglyidentifies that the physical erase unit 304(0), the physical erase unit304(D+1), the physical erase unit 304(D+2), and the physical erase unit304(D+3) contain data belonging to the logical address LBA(0) and thephysical erase unit 304(D+3) is the last written physical erase unit. Inaddition, the memory controller 104 (or the memory management circuit202) identifies the last written physical program unit (for example, the2^(nd) physical program unit) in the physical erase unit 304(D+3) anddetermines whether data stored in the 2^(nd) physical program unit ofthe physical erase unit 304(D+3) contains any error bit. For example,the ECC circuit 256 performs an ECC procedure on the data stored in the2^(nd) physical program unit of the physical erase unit 304(D+3)according to an ECC code read from the redundant bit area of the 2^(nd)physical program unit in the physical erase unit 304(D+3).

If the data stored in the 2^(nd) physical program unit of the physicalerase unit 304(D+3) does not contain any error bit, the memorycontroller 104 (or the memory management circuit 202) continues toperform the data merging procedure by using the physical erase unit304(D+3).

If the data stored in the 2^(nd) physical program unit of the physicalerase unit 304(D+3) contains error bits and the error bits are notcorrectable (i.e., the number of error bits in the data is greater thanthe maximum correctable error bit number), the memory controller 104 (orthe memory management circuit 202) performs an erasing operation on thephysical erase unit 304(D+3) and keeps using the physical erase unit304(0), the physical erase unit 304(D+1), and the physical erase unit304(D+2) to store valid data belonging to the logical address LBA(0)(i.e., without completing the data merging procedure).

If the data stored in the 2^(nd) physical program unit of the physicalerase unit 304(D+3) contains error bits and the error bits arecorrectable (i.e., the number of error bits in the data is not greaterthan the maximum correctable error bit number), the memory controller104 (or the memory management circuit 202) determines whether thephysical erase unit 304(D+3) contains any dancing bit. Herein a physicalerase unit containing dancing bits means that the charges stored in thephysical erase unit are in an unstable state. In particular, when aphysical erase unit contains dancing bits, data in the physical eraseunit may be correctly read but will be lost after some time.

For example, in an exemplary embodiment of the present invention, thememory controller 104 (or the memory management circuit 202) determineswhether the number of error bits in the data stored in the 2^(nd)physical program unit of the physical erase unit 304(D+3) is greaterthan the error bit number threshold. If the number of error bits in thedata stored in the 2^(nd) physical program unit of the physical eraseunit 304(D+3) is greater than the error bit number threshold, the memorycontroller 104 (or the memory management circuit 202) identifies thatthe physical erase unit 304(D+3) contains dancing bits. In the presentexemplary embodiment, the error bit number threshold is set to 20.However, the present invention is not limited thereto.

If the physical erase unit 304(D+3) does not contain any dancing bit,the memory controller 104 (or the memory management circuit 202)continues to perform the data merging procedure by using the physicalerase unit 304(D+3). Contrarily, if the physical erase unit 304(D+3)contains dancing bits, the memory controller 104 (or the memorymanagement circuit 202) performs an erasing operation on the physicalerase unit 304(D+3) and keeps using the physical erase unit 304(0), thephysical erase unit 304(D+1), and the physical erase unit 304(D+2) tostore valid data belonging to the logical address LBA(0) (i.e., withoutcompleting the data merging procedure).

As described above, when a power failure occurs in the course ofperforming a data merging procedure, the memory controller 104 (or thememory management circuit 202) ensures the reliability of a stored databy identifying whether a physical erase unit contains any dancing bit.

FIG. 13 is a flowchart of a data storing method according to anexemplary embodiment of the present invention.

Referring to FIG. 13, when a data merging procedure is to be performed,in step S1301, the memory controller 104 (or the memory managementcircuit 202) selects a data physical erase unit in a mother-childphysical erase unit set state among the physical erase units in the dataarea 402. Herein the data physical erase unit is mapped to a firstlogical address, and at least one physical erase unit is selected fromthe spare area 404 and served as a temporary physical erase unitcorresponding to the data physical erase unit.

In step S1303, the memory controller 104 (or the memory managementcircuit 202) selects a physical erase unit (referred to as a firstphysical erase unit) from the spare area 404 and moves valid databelonging to the first logical address from the data physical erase unitand the temporary physical erase unit into the first physical eraseunit.

In step S1305, the memory controller 104 (or the memory managementcircuit 202) determines whether a power failure occurs.

If no power failure occurs, the procedure illustrated in FIG. 13 isterminated. To be specific, if no abnormality occurs during the datamerging procedure, the memory controller 104 (or the memory managementcircuit 202) identifies that the data merging procedure is successfullycompleted.

If a power failure occurs, in step S1307, the memory controller 104 (orthe memory management circuit 202) determines whether the first physicalerase unit contains a dancing bit.

If the first physical erase unit does not contain the dancing bit, instep S1309, the memory controller 104 (or the memory management circuit202) continues to move valid data belonging to the first logical addressfrom the data physical erase unit and the temporary physical erase unitinto the first physical erase unit.

If the first physical erase unit contains the dancing bit, in stepS1311, the memory controller 104 (or the memory management circuit 202)performs an erasing operation on the first physical erase unit and linksthe first physical erase unit to the spare area 404.

In another exemplary embodiment of the invention, after the step S1311,the memory controller 104 (or the memory management circuit 202)instantly selects a second physical erase unit among the physical eraseunits in the spare area 404 and moves valid data belonging to the firstlogical address from the data physical erase unit and the temporaryphysical erase unit into the second physical erase unit, so as tocomplete the data merging procedure. However, the invention is notlimited thereto, and the memory controller 104 (or the memory managementcircuit 202) may also perform the data merging procedure again at anyother suitable time.

Besides ensuring data reliability by determining whether a physicalerase unit contains any dancing bit during a data merging procedure, inanother exemplary embodiment of the present invention, the memorycontroller 104 (or the memory management circuit 202) further ensure thereliability of system data by determining whether the physical eraseunit contains any dancing bit while writing the system data into thesystem area 406.

As described above, the physical erase units 304(N+1)-304(S) areinitially configured in the system area 406 for storing system data.Generally speaking, the quantity of system data is smaller than thecapacity of a physical erase unit. Thus, the memory controller 104 (orthe memory management circuit 202) continues to use the physical programunits of the physical erase units in the system area 406 for writingupdated system data.

FIG. 14 is a diagram illustrating how a system data is stored accordingto an exemplary embodiment of the present invention.

Referring to FIG. 14, herein it is assumed that a system data SD1 needsto take up the capacity of one physical program unit. While writing thesystem data SD1 into the 0^(th) physical program unit of the physicalerase unit 304(N+1) in the system area 406, the memory controller 104(or the memory management circuit 202) determines whether the physicalerase unit 304(N+1) contains any dancing bit.

For example, as described above, the memory controller 104 (or thememory management circuit 202) reads the system data SD1 written intothe 0^(th) physical program unit of the physical erase unit 304(N+1) anddetermines whether the number of error bits in the system data SD1 isgreater than an error bit number threshold and not greater than amaximum correctable error bit number. If the number of error bits in thesystem data SD1 is greater than the error bit number threshold and notgreater than the maximum correctable error bit number, the memorycontroller 104 (or the memory management circuit 202) determines thatthe physical erase unit 304(N+1) contains dancing bits. Contrarily, thememory controller 104 (or the memory management circuit 202) determinesthat the physical erase unit 304(N+1) does not contain any dancing bit.

Particularly, if the physical erase unit 304(N+1) contains a dancingbit, the memory controller 104 (or the memory management circuit 202)selects another physical erase unit (for example, the physical eraseunit 304(N+2)) from the system area 406 and writes the system data SD1into the physical erase unit 304(N+2). Similarly, after writing thesystem data SD1, the memory controller 104 (or the memory managementcircuit 202) determines whether the physical erase unit contains anydancing bit. It should be mentioned that if the physical erase unit304(N+1) also contains other valid data besides the system data SD1, inanother exemplary embodiment of the invention, the memory controller 104(or the memory management circuit 202) first moves the valid data fromthe physical erase unit 304(N+1) to the physical erase unit 304(N+2) andthen writes the system data SD1 into the physical erase unit 304(N+2).

If the physical erase unit 304(N+1) does not contain any dancing bit,the memory controller 104 (or the memory management circuit 202)identifies that the system data SD1 has been reliably stored.Subsequently, when the system data SD1 is to be replaced by a new systemdata SD2, the memory controller 104 (or the memory management circuit202) writes the system data SD2 into the 1^(st) physical program unit ofthe physical erase unit 304(N+1) in the system area 406 and determinesagain whether the physical erase unit 304(N+1) contains any dancing bit(as shown in FIG. 15). Thereby, the memory controller 104 (or the memorymanagement circuit 202) can ensure the accuracy of the system data everytime when the system data is updated.

In the present exemplary embodiment, multiple physical erase units areconfigured in the system area 406 when the memory storage device 100 isinitialized. However, the present invention is not limited thereto, andin another exemplary embodiment of the invention, one physical eraseunit may also be initially configured in the system area 406, and when ablank physical erase unit is required for storing system data, thememory controller 104 (or the memory management circuit 202) may selecta physical erase unit from the spare area 404 as the physical erase unitin the system area 406. In addition, the physical erase units containinginvalid data in the system area 406 may also be erased and linked to thespare area 404 to be used again.

FIG. 16 is a flowchart of a data storing method according to anotherexemplary embodiment of the invention, in which the steps of writingsystem data into the system area are illustrated.

Referring to FIG. 16, in step 1601, the memory controller 104 (or thememory management circuit 202) writes system data into a physical eraseunit (referred to as a first physical erase unit thereinafter) in thesystem area 406.

In step S1603, the memory controller 104 (or the memory managementcircuit 202) determines whether the first physical erase unit containsany dancing bit.

If the first physical erase unit does not contain the dancing bit, theprocedure illustrated in FIG. 16 is terminated.

If the first physical erase unit contains the dancing bit, in stepS1605, the memory controller 104 (or the memory management circuit 202)selects another physical erase unit (referred to as a second physicalerase unit thereinafter) from the system area 406. Besides, in stepS1607, the memory controller 104 (or the memory management circuit 202)writes the system data into the second physical erase unit.Particularly, in another exemplary embodiment, when step S1607 isexecuted, the memory controller 104 (or the memory management circuit202) determines whether the first physical erase unit contains othervalid data. If the first physical erase unit contains other valid data,the memory controller 104 (or the memory management circuit 202) movesthe valid data from the first physical erase unit to the second physicalerase unit.

In another exemplary embodiment of the invention, after step S1607, thememory controller 104 (or the memory management circuit 202) furtherperforms an erasing operation on the first physical erase unit and linksthe first physical erase unit to the spare area 404.

As described above, in a data storing method, a memory controller, and amemory storage device provided by an exemplary embodiment of theinvention, when a power failure occurs, whether a physical program unitprogrammed during a data merging procedure contains any dancing bit isdetermined, and if the physical program unit contains a dancing bit, thestate before the data merging procedure is performed is resumed, so thatthe data reliability and accuracy is effectively ensured. Additionally,in the data storing method, the memory controller, and the memorystorage device provided by an exemplary embodiment of the invention,whether the programmed physical program unit contains any dancing bit isdetermined when a system data is written, and if the physical programunit contains a dancing bit, the valid data is moved to another address,so that the reliability and accuracy of the system data is effectivelyensured. The previously described exemplary embodiments of the presentinvention have the advantages aforementioned, wherein the advantagesaforementioned not required in all versions of the invention.

It will be apparent to those skilled in the art that variousmodifications and variations can be made to the structure of theinvention without departing from the scope or spirit of the invention.In view of the foregoing, it is intended that the invention covermodifications and variations of this invention provided they fall withinthe scope of the following claims and their equivalents.

What is claimed is:
 1. A data storing method for a rewritablenon-volatile memory module, wherein the rewritable non-volatile memorymodule has a plurality of physical erase units, each of the physicalerase units has a plurality of physical program units, and the physicalerase units are grouped into at least a system area, the data storingmethod comprising: writing system data into a first physical erase unitin the system area; determining whether the first physical erase unitcontains a dancing bit; and when the first physical erase unit containsthe dancing bit, selecting a second physical erase unit among thephysical erase units, and writing the system data into the secondphysical erase unit.
 2. The data storing method according to claim 1further comprising: moving valid data in the first physical erase unitinto the second physical erase unit.
 3. The data storing methodaccording to claim 2 further comprising: after moving the valid data inthe first physical erase unit into the second physical erase unit,executing an erasing operation on the first physical erase unit.
 4. Thedata storing method according to claim 1, wherein the step ofdetermining whether the first physical erase unit contains the dancingbit comprises: determining whether the number of error bits in datastored in a first physical program unit among the physical program unitsof the first physical erase unit is greater than an error bit numberthreshold and not greater than a maximum correctable error bit number,wherein the system data is written into the first physical program unit;and when the number of error bits in the data stored in the firstphysical program unit is greater than the error bit number threshold andnot greater than the maximum correctable error bit number, determiningthat the first physical erase unit contains the dancing bit.
 5. A memorycontroller for controlling a rewritable non-volatile memory module,wherein the rewritable non-volatile memory module has a plurality ofphysical erase units, each of the physical erase units has a pluralityof physical program units, the memory controller comprising: a hostinterface configured to couple to a host system; a memory interfaceconfigured to couple to the rewritable non-volatile memory module; and amemory management circuit coupled to the host interface and the memoryinterface, wherein the memory management circuit groups the physicalerase units into at least a system area, wherein the memory managementcircuit writes system data into a first physical erase unit in thesystem area, and determines whether the first physical erase unitcontains a dancing bit, wherein if the first physical erase unitcontains the dancing bit, the memory management circuit selects a secondphysical erase unit among the physical erase units and writes the systemdata into the second physical erase unit.
 6. The memory controlleraccording to claim 5, wherein the memory management circuit moves validdata in the first physical erase unit into the second physical eraseunit.
 7. The memory controller according to claim 6, wherein aftermoving the valid data in the first physical erase unit into the secondphysical erase unit, the memory management circuit executes an erasingoperation on the first physical erase unit.
 8. The memory controlleraccording to claim 5, wherein in the operation of determining whetherthe first physical erase unit contains the dancing bit, the memorymanagement circuit determines whether the number of error bits in datastored in a first physical program unit among the physical program unitsof the first physical erase unit is greater than an error bit numberthreshold and not greater than a maximum correctable error bit number,wherein the system data is written into the first physical program unit,wherein if the number of error bits in the data stored in the firstphysical program unit is greater than the error bit number threshold andnot greater than the maximum correctable error bit number, the memorymanagement circuit determines that the first physical erase unitcontains the dancing bit.
 9. A memory storage device, comprising: aconnector configured to couple to a host system; a rewritablenon-volatile memory module having a plurality of physical erase units,wherein each of the physical erase units has a plurality of physicalprogram units; and a memory controller coupled to the connector and therewritable non-volatile memory module, wherein the memory controllergroups the physical erase units into at least a system area, wherein thememory controller writes system data into a first physical erase unit inthe system area, and determines whether the first physical erase unitcontains a dancing bit, wherein if the first physical erase unitcontains the dancing bit, the memory controller selects a secondphysical erase unit among the physical erase units and writes the systemdata into the second physical erase unit.
 10. The memory storage deviceaccording to claim 9, wherein the memory controller moves valid data inthe first physical erase unit into the second physical erase unit. 11.The memory storage device according to claim 10, wherein after movingthe valid data in the first physical erase unit into the second physicalerase unit, the memory controller executes an erasing operation on thefirst physical erase unit.
 12. The memory storage device according toclaim 9, wherein in the operation of determining whether the firstphysical erase unit contains the dancing bit, the memory controllerdetermines whether the number of error bits in data stored in a firstphysical program unit among the physical program units of the firstphysical erase unit is greater than an error bit number threshold andnot greater than a maximum correctable error bit number, wherein thesystem data is written into the first physical program unit, wherein ifthe number of error bits in the data stored in the first physicalprogram unit is greater than the error bit number threshold and notgreater than the maximum correctable error bit number, the memorymanagement circuit determines that the first physical erase unitcontains the dancing bit.